package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/index"
	"private-domain-overseas-service/pkg/status/bizsystemsmsrecord"
	"time"
)

type HzSystemSmsRecord struct {
	ent.Schema
}

// Fields of the HzSystemSmsRecord.
func (HzSystemSmsRecord) Fields() []ent.Field {
	return []ent.Field{
		field.String("system_sms_area").Optional().Comment("短信区号"),
		field.String("system_sms_captcha").Optional().Comment("验证码"),
		field.String("system_sms_phone").Comment("短信手机号"),
		field.String("system_sms_message").Comment("短信内容"),
		field.String("system_sms_description").Comment("短信描述"),
		field.Int64("system_sms_type").Default(bizsystemsmsrecord.SmsTypeCaptcha).Comment("短信类型：1 验证码"),
		field.Int64("system_sms_status").Default(bizsystemsmsrecord.SmsStatusUse).Comment("短信状态:1、已使用，2、未使用，3、发送失败"),
		field.Int64("system_sms_platform").Default(bizsystemsmsrecord.SmsPlatformBack).Comment("短信类型：1、后台，2、客户端"),
		field.Int64("system_sms_send_at").Comment("短信发送时间"),
		field.Int64("system_sms_expire_at").Comment("短信过期时间"),
		field.Int64("created_at").Immutable().Default(time.Now().Unix()).Comment("创建时间"),
		field.Int64("update_at").Optional().Default(time.Now().Unix()).Comment("更新时间"),
		field.Int64("delete_at").Optional().Comment("删除时间"),
	}
}

func (HzSystemSmsRecord) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("system_sms_phone"),
		index.Fields("system_sms_area"),
	}
}

func (HzSystemSmsRecord) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
		schema.Comment("系统短信表"),
	}
}
